package com.sg.controller.bff;

import com.sg.service.biz.bff.UserService;
import com.sg.dto.biz.bff.req.*;
import com.sg.dto.biz.bff.res.*;
import com.sg.common.ro.OkrResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author ：
 * @version 1.0
 * @date ：
 */
@Api(value = "User", tags = {"User"})
@RestController
// @RequestMapping("/oms/user/")
public class UserController {

    @Autowired
    UserService userService;

    /**
     * 登录
     * gen by moon at 8/17/2022, 7:39:27 PM
     */
    @PostMapping("/oms/user/login")
    @ApiOperation(value = "登录", response = OkrResult.class)
    public OkrResult<BffLoginRespDto> login(@RequestBody(required = false) @Validated BffLoginReqDto reqDTO) {
        return OkrResult.success(userService.login(reqDTO));
    }

    /**
     * B1-切换公共信息
     * gen by moon at 8/10/2022, 3:36:23 AM
     */
    @PostMapping("/oms/user/changePublicInfo")
    @ApiOperation(value = "B1-切换公共信息", response = OkrResult.class)
    public OkrResult<BffChangePublicInfoRespDto> changePublicInfo(@RequestBody(required = false) @Validated BffChangePublicInfoReqDto reqDTO) {
        return OkrResult.success(userService.changePublicInfo(reqDTO));
    }


    /**
     * B1-2换绑手机号
     * gen by moon at 8/10/2022, 3:29:26 AM
     */
    @PostMapping("/oms/user/updateChangePhone")
    @ApiOperation(value = "B1-2换绑手机号", response = OkrResult.class)
    public OkrResult<BffUpdateChangePhoneRespDto> updateChangePhone(@RequestBody(required = false) @Validated BffUpdateChangePhoneReqDto reqDTO) {
        return OkrResult.success(userService.updateChangePhone(reqDTO));
    }

    /**
     * B1-2退出登录
     * gen by moon at 8/10/2022, 3:29:22 AM
     */
    @PostMapping("/oms/user/logout")
    @ApiOperation(value = "B1-2退出登录", response = OkrResult.class)
    public OkrResult<BffLogoutRespDto> logout(@RequestBody(required = false) @Validated BffLogoutReqDto reqDTO) {
        return OkrResult.success(userService.logout(reqDTO));
    }

    /**
     * B1-2修改个人资料
     * gen by moon at 8/10/2022, 3:29:18 AM
     */
    @PostMapping("/oms/user/updateUserInfo")
    @ApiOperation(value = "B1-2修改个人资料", response = OkrResult.class)
    public OkrResult<BffUpdateUserInfoRespDto> updateUserInfo(@RequestBody(required = false) @Validated BffUpdateUserInfoReqDto reqDTO) {
        return OkrResult.success(userService.updateUserInfo(reqDTO));
    }

    /**
     * B1-2查询账号安全信息列表
     * gen by moon at 8/10/2022, 3:31:50 AM
     */
    @PostMapping("/oms/user/queryAccountSecurityList")
    @ApiOperation(value = "B1-2查询账号安全信息列表", response = OkrResult.class)
    public OkrResult<BffQueryAccountSecurityListRespDto> queryAccountSecurityList(@RequestBody(required = false) @Validated BffQueryAccountSecurityListReqDto reqDTO) {
        return OkrResult.success(userService.queryAccountSecurityList(reqDTO));
    }

    /**
     * B1-2首次登录完善个人资料
     * gen by moon at 9/7/2022, 1:49:03 AM
     */
    @PostMapping("/oms/user/updateRenewUserInfo")
    @ApiOperation(value = "B1-2首次登录完善个人资料", response = OkrResult.class)
    public OkrResult<BffUpdateRenewUserInfoRespDto> updateRenewUserInfo(@RequestBody(required = false) @Validated BffUpdateRenewUserInfoReqDto reqDTO) {
        return OkrResult.success(userService.updateRenewUserInfo(reqDTO));
    }

    /**
     * B1-2查询个人信息详情
     * gen by moon at 8/10/2022, 3:29:13 AM
     */
    @PostMapping("/oms/user/queryPersonalInformationDetail")
    @ApiOperation(value = "B1-2查询个人信息详情", response = OkrResult.class)
    public OkrResult<BffQueryPersonalInformationDetailRespDto> queryPersonalInformationDetail(@RequestBody(required = false) @Validated BffQueryPersonalInformationDetailReqDto reqDTO) {
        return OkrResult.success(userService.queryPersonalInformationDetail(reqDTO));
    }

    /**
     * B1-查询用户登录信息（非Redis）
     * gen by moon at 9/29/2022, 3:50:52 PM
     */
    @PostMapping("/oms/user/queryUserInfoByLoginDetail")
    @ApiOperation(value = "B1-查询用户登录信息（非Redis）", response = OkrResult.class)
    public OkrResult<BffQueryUserInfoByLoginDetailRespDto> queryUserInfoByLoginDetail(@RequestBody(required = false) @Validated BffQueryUserInfoByLoginDetailReqDto reqDTO) {
        return OkrResult.success(userService.queryUserInfoByLoginDetail(reqDTO));
    }

    /**
     * 登录V2
     * gen by moon at 9/30/2022, 3:37:37 PM
     */
    @PostMapping("/oms/user/logUserIn")
    @ApiOperation(value = "登录V2", response = OkrResult.class)
    public OkrResult<BffLogUserinRespDto> LogUserin(@RequestBody(required = false) @Validated BffLogUserinReqDto reqDTO) {
        return OkrResult.success(userService.LogUserin(reqDTO));
    }

    /**
     * B1-2查询个人密保问题详情
     * gen by moon at 9/7/2022, 3:58:51 PM
     */
    @PostMapping("/oms/user/queryUserPwdProblemDetail")
    @ApiOperation(value = "B1-2查询个人密保问题详情", response = OkrResult.class)
    public OkrResult<BffQueryUserPwdProblemDetailRespDto> queryUserPwdProblemDetail(@RequestBody(required = false) @Validated BffQueryUserPwdProblemDetailReqDto reqDTO) {
        return OkrResult.success(userService.queryUserPwdProblemDetail(reqDTO));
    }

    /**
     * B1-2查询密保问题详情
     * gen by moon at 5/21/2023, 10:22:35 PM
     */
    @PostMapping("/oms/user/queryPwdProblemDetail")
    @ApiOperation(value = "B1-2查询密保问题详情", response = OkrResult.class)
    public OkrResult<BffQueryPwdProblemDetailRespDto> queryPwdProblemDetail(@RequestBody(required = false) @Validated BffQueryPwdProblemDetailReqDto reqDTO) {
        return OkrResult.success(userService.queryPwdProblemDetail(reqDTO));
    }

    /**
     * B1查询个人资料详情(公共)
     * gen by moon at 6/1/2023, 2:52:17 AM
     */
    @PostMapping("/oms/user/queryUserInfoDetailCom")
    @ApiOperation(value = "B1查询个人资料详情(公共)", response = OkrResult.class)
    public OkrResult<BffQueryUserInfoDetailComRespDto> queryUserInfoDetailCom(@RequestBody(required = false) @Validated BffQueryUserInfoDetailComReqDto reqDTO) {
        return OkrResult.success(userService.queryUserInfoDetailCom(reqDTO));
    }

    /**
     * 登录V3
     * gen by moon at 9/12/2023, 8:12:59 PM
     */
    @PostMapping("/oms/user/implementLogin")
    @ApiOperation(value = "登录V3", response = OkrResult.class)
    public OkrResult<BffImplementLoginRespDto> implementLogin(@RequestBody(required = false) @Validated BffImplementLoginReqDto reqDTO) {
        return OkrResult.success(userService.implementLogin(reqDTO));
    }

    /**
     * B1查询获取统一认证登录信息详情
     * gen by moon at 12/21/2023, 12:58:07 AM
     */
    @PostMapping("/oms/user/queryObtainUnifiedAuthenticationLoginInformationDetail")
    @ApiOperation(value = "B1查询获取统一认证登录信息详情", response = OkrResult.class)
    public OkrResult<BffQueryObtainUnifiedAuthenticationLoginInformationDetailRespDto> queryObtainUnifiedAuthenticationLoginInformationDetail(@RequestBody(required = false) @Validated BffQueryObtainUnifiedAuthenticationLoginInformationDetailReqDto reqDTO) {
        return OkrResult.success(userService.queryObtainUnifiedAuthenticationLoginInformationDetail(reqDTO));
    }

    /**
     * B1-执行第三方退出登录
     * gen by moon at 12/23/2023, 1:50:08 AM
     */
    @PostMapping("/oms/user/implementThirdPartyLoginOut")
    @ApiOperation(value = "B1-执行第三方退出登录", response = OkrResult.class)
    public OkrResult<BffImplementThirdPartyLoginOutRespDto> implementThirdPartyLoginOut(@RequestBody(required = false) @Validated BffImplementThirdPartyLoginOutReqDto reqDTO) {
        return OkrResult.success(userService.implementThirdPartyLoginOut(reqDTO));
    }
}
